package gamebackend;
import generators.VerticalScaredGenerator;
import generators.VerticalStreakGenerator;
import gui.BlockStyle;

import framework.Color;
import java.util.Random;



public class ColorfulBiome extends GameSession.Biome {

	private final Block my_block = new Block(BlockStyle.THORN, new Color(70, 100, 250));
	private final Block my_back = new Block(BlockStyle.THORN, new Color(0, 0, 0, 0));
	
	public ColorfulBiome(GameSession the_session,
			int the_tier, Random the_random, double the_length) {
		the_session.super(the_session, the_tier, the_random, the_length);
		
		addHardPath(new FlightPath(Block.SECONDARY_PATH, getHardPath(), 16,
				new StutterFlier(15, getWidth() - 15, getWidth() / 10.0, getRandom())), getLength());
		addEasyPath(new FlightPath(Block.PRIMARY_PATH, getEasyPath(), 20,
				new StutterFlier(20, getWidth() - 20, getWidth() / 10.0, getRandom())), getLength());
		
		addGenerator(new VerticalScaredGenerator(my_block, getRandom(), .1), getLength());
		addGenerator(new VerticalStreakGenerator(getRandom(), .5), getLength());
		//addToMidGround(new ReplaceGenerator(Block.PRIMARY_PATH, my_back), the_length);
	}
	private int my_distanceToColorChange;
	public void step(final double the_yChange) {
		super.step(the_yChange);
		my_distanceToColorChange -= the_yChange;
		if (my_distanceToColorChange < 0) {
			my_distanceToColorChange += 500;
			final Color color = Block.getRandomColor(getRandom(), 450, 60);
			my_block.setColor(color);
			my_back.setColor(Block.getBackgroundColor(color));
		}
				
	}
	
	

}
